/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.cip.esymons.tesoreria.utilitarios;

/**
 *
 * @author Gilmar
 */
/**
 * License Agreement.
 *
 * Rich Faces - Natural Ajax for Java Server Faces (JSF)
 *
 * Copyright (C) 2007 Exadel, Inc.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License version 2.1 as published by the Free Software Foundation.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
 */
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.richfaces.event.UploadEvent;
import org.richfaces.model.UploadItem;

/**
 * @author $Autor$
 *
 */
public class Bean {

    private List<FileData> data = new ArrayList();
    private boolean flag;
    private String fileTypes = "*";
    private Integer maxFiles = 5;
    private String width = "400";
    private String height = "210";

    public boolean isFlag() {
        return flag;
    }

    public List<FileData> getFileList() {
        return data;
    }

    public void setFlag(boolean flag) {
        this.flag = flag;
    }

    public void listener(UploadEvent event) throws IOException {
        UploadItem item = event.getUploadItem();
        System.out.println("File : '" + item.getFileName() + "' was uploaded");
        if (item.isTempFile()) {
            File file = item.getFile();
            System.out.println("Absolute Path : '" + file.getAbsolutePath() + "'!");
        } else {
            ByteArrayOutputStream b = new ByteArrayOutputStream();
            b.write(item.getData());
            System.out.println(b.toString());
        }
    }

    /**
     * @return the data
     */
    public List<FileData> getData() {
        return data;
    }

    /**
     * @param data the data to set
     */
    public void setData(List<FileData> data) {
        this.data = data;
    }

    /**
     * @return the fileTypes
     */
    public String getFileTypes() {
        return fileTypes;
    }

    /**
     * @param fileTypes the fileTypes to set
     */
    public void setFileTypes(String fileTypes) {
        this.fileTypes = fileTypes;
    }

    /**
     * @return the maxFiles
     */
    public Integer getMaxFiles() {
        return maxFiles;
    }

    /**
     * @param maxFiles the maxFiles to set
     */
    public void setMaxFiles(Integer maxFiles) {
        this.maxFiles = maxFiles;
    }

    /**
     * @return the width
     */
    public String getWidth() {
        return width;
    }

    /**
     * @param width the width to set
     */
    public void setWidth(String width) {
        this.width = width;
    }

    /**
     * @return the height
     */
    public String getHeight() {
        return height;
    }

    /**
     * @param height the height to set
     */
    public void setHeight(String height) {
        this.height = height;
    }
}



